package com.twu.biblioteca.menu;

import com.twu.biblioteca.LibraryManager;

public class AllMovies implements MenuOption {


    private AllMovies instance;

    public final AllMovies getInstance() {
        if(instance == null){
            this.instance = new AllMovies();
        }
        return instance;
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AllMovies allMovies = (AllMovies) o;

        if (instance != null ? !instance.equals(allMovies.instance) : allMovies.instance != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return instance != null ? instance.hashCode() : 0;
    }

    @Override
    public void execute() {
        LibraryManager libraryManager = LibraryManager.getInstance();
        libraryManager.displayMovies();
        libraryManager.printToScreen(libraryManager.getOutput());
    }
}
